package com.stox.ui.javafx.charting.widget.axis;

import javafx.geometry.Bounds;
import javafx.geometry.Side;
import javafx.geometry.VPos;
import javafx.scene.text.TextAlignment;

import com.stox.ui.javafx.charting.widget.PrimaryChart;

public abstract class AbstractHorizontalAxis extends AbstractAxis<PrimaryChart<?>> {

	private static final double height = 20;

	public static final double padding = 2;

	public AbstractHorizontalAxis() {
		prefHeight(height);
		setHeight(height);

		gc.setTextAlign(TextAlignment.CENTER);
        gc.setTextBaseline(VPos.BASELINE);
	}
	
	public void paint() {
		super.paint();
		setWidth(getChart().getWidth());
		Bounds bounds = getChart().getCenter().getBoundsInParent();
		double y = Side.BOTTOM.equals(getSide()) ? 0 : getHeight();
		gc.strokeLine(bounds.getMinX(), y, bounds.getMaxX(), y);
	}
	
}
